home *** CD-ROM | disk | FTP | other *** search
- File Caching
- ============
-
- Turbo V1.2 introduced symbol & object file caching.
- The desire is of course to speed up compilation & linking.
- Its always been possible to make m2b, m2c, m2l, dcc, dlink resident,
- (S/RESALL script will make them resident for you) which speeds things up
- too. However caching and residence will eat memory.
-
- Symbol File Cache
- -----------------
-
- M2C generates a persistent symbol file cache data structure, this
- cache is anchored on the '!m2cache' message port (maintained by Exec).
- This port is for internal use only, dont try to send it any messages.
-
- Symbol file caching is by default enabled, 'setenv M2SYMCACHE=OFF' if you
- dont have the memory and so want to disable it. If no M2SYMCACHE env-var
- exists, symbol file caching is assumed ON.
-
- Symbol files are only cached when they are loaded not when they are written.
- The cache contains expanded images of the symbol files on disk.
- The loaded image is typically 4 times larger than the one on disk.
-
- The cache can contain multiple versions of the same named symbol file.
- This means you can change directory and start compiling a different program
- with the same named modules with out having to flush the cache.
- The compiler decides which cached version to use by examining the disk based
- symbol files internal timestamp (this requires a disk access to read the
- first 20 bytes).
- M2C insists that there always be a disk based symbol file.
- If no cached symbol file matches the one on disk (even if any have the same
- name), then the disked symbol file will be loaded into the cache.
-
- The compiler will automatically handle cache updating:
- When a symbol file is generated by the compiler (when you compile a .def),
- then the compiler will automatically remove any copy of the overwritten
- symbol file from the cache. It will then recursively remove any cached
- symbol file that used (imported) the removed one.
- However if you manually c:delete a symbol file from disk, then any
- cached copy will remain in the cache until it is flushed (by M2F).
-
- Use bin/M2S to see which files have been cached.
- Use bin/M2F to flush the symbol file cache.
-
- Only one process (m2c,m2s or m2f) can be accessing the cache at any time,
- If a second m2c is started while the first is still running, then the
- second m2c degenerates to reading off disk.
- This should not be too much of a problem: When did you last mulitask M2C
- with itself?
-
- The speed up in compilation (as a result of symbol file caching) is most
- noticeable on slower Amigas.
-
- Object File Cache
- -----------------
-
- Unlike symbol files, object files are not cached by default, the
- S/TURBOLINK script will enable the object file cache.
-
- Object file caching is not as good as the symbol file caching mechanism
- because i dont have access to the internal parts of the linker.
- To improve things, i could implement my own linker, but this is low on my
- list of priorities.
- The object file cache uses the RAM DISK to store copies of used object
- files, so as to avoid loading from disk. This is not as efficient as
- making the object file 'resident', since during linking there will
- effectively be two copies in ram.
-
- To really speed linking you must make M2L, DCC, DLINK resident and copy and
- reassign dlib:#? to ram:, the S/TURBOLINK script will do all this for you.
- By doing all the above, disk activity during linking is greatly reduced and
- so linking should be faster. This gives the most speed up on high end
- Amigas (030/25+), where disk access is probably the main performance bottle
- neck (during linking at least). Slower Amigas will also benefit, but its
- only worth doing on slower machines if you have the spare memory.
-
- Dont start the TURBOLINK script unless your system has 500Kbs of spare ram.
-
- The environment variable M2OBJCACHE must point a ramdisk directory.
- M2L will read the M2OBJCACHE env-var and cache object files into the
- directory it point to.
- The TURBOLINK script will create and assign M2OBJCACHE for you.
-
- The S/OFLUSH script will flush the object file cache.
- The S/OSHOW script will list the cache directory.
-
- If you intend to use the above scripts make sure 'modula:s' is in your path,
- s/startup adds it, also make sure the 's' bit is set on all the files
- in this directory (LHA clears them unless you extract the archive with -a):
-
- >protect modula:s/#? s add
-
- Doing this avoids the need to prefix the 'execute' command when starting
- the scripts.
-
- Any object files created with M2C V1.1 will not be cached.
-
- It took me 20 times longer to implement the symbol file cache.
-